/*
 * p1410.cpp
 *
 *  Created on: 2013-3-15
 *      Author: zy
 */

#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int sig(double d) {
	return fabs(d) < 1E-6 ? 0 : d < 0 ? -1 : 1;
}
struct Point{
	double x,y;
	Point(){}
	Point(double x, double y): x(x), y(y) {}
	void set(double x, double y) {
		this->x = x;
		this->y = y;
	}
};
double dot(Point &o, Point &a, Point &b) {
	return (a.x-o.x)*(b.x-o.x) + (a.y-o.y)*(b.y-o.y);
}
double cross(Point o, Point a, Point b) {
	return (a.x - o.x)*(b.y - o.y)-(b.x - o.x)*(a.y - o.y);
}
int btw(Point &x, Point &a, Point &b) {
	return sig(dot(x, a, b));
}
int segCross(Point a, Point b, Point c, Point d, Point &p) {
	double s1, s2;
	int d1, d2, d3, d4;
	d1 = sig(s1=cross(a,b,c));
	d2 = sig(s2=cross(a,b,d));
	d3 = sig(cross(c,d,a));
	d4 = sig(cross(c,d,b));
	if((d1^d2)==-2 && (d3^d4)==-2) {
		p.x = (c.x*s2-d.x*s1)/(s2-s1);
		p.y = (c.y*s2-d.y*s1)/(s2-s1);
		return 1;
	}
	if( d1==0 && btw(c,a,b)<=0 ||
		d2==0 && btw(d,a,b)<=0 ||
		d3==0 && btw(a,c,d)<=0 ||
		d4==0 && btw(b,c,d)<=0)
		return 2;
	return 0;
}
bool inRec(Point a,Point b,Point lb,Point lt,Point rb,Point rt)
{
	bool f1=false,f2=false;
	if(a.x>lb.x&&a.x<rb.x&&a.y>lb.y&&a.y<lt.y)f1=true;
	if(b.x>lb.x&&b.x<rb.x&&b.y>lb.y&&b.y<lt.y)f2=true;
	if(f1&&f2)return true;
	return false;
}
int main()
{
	int T;
	cin>>T;
	while(T--)
	{
		int x1,y1,x2,y2,xl,yt,xr,yb,x3,x4,y3,y4;
		scanf("%d%d%d%d%d%d%d%d",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
		xl=min(x3,x4);xr=max(x3,x4);
		yt=max(y3,y4);yb=min(y3,y4);
		Point a,b,lb,lt,rb,rt,t;
		a.set(x1,y1);
		b.set(x2,y2);
		lb.set(xl,yb);
		lt.set(xl,yt);
		rb.set(xr,yb);
		rt.set(xr,yt);
		if(inRec(a,b,lb,lt,rb,rt)||segCross(a,b,lb,lt,t)||segCross(a,b,rb,rt,t)||segCross(a,b,lt,rt,t)||segCross(a,b,lb,rb,t))
			cout<<"T"<<endl;
		else cout<<"F"<<endl;
	}
	return 0;
}

